/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ChArFaTo
 */
@Entity
@Table(name = "estudiante", catalog = "proyectosw", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EstudianteEJB.findAll", query = "SELECT e FROM EstudianteEJB e"),
    @NamedQuery(name = "EstudianteEJB.findByECodigo", query = "SELECT e FROM EstudianteEJB e WHERE e.eCodigo = :eCodigo"),
    @NamedQuery(name = "EstudianteEJB.findByESemestre", query = "SELECT e FROM EstudianteEJB e WHERE e.eSemestre = :eSemestre"),
    @NamedQuery(name = "EstudianteEJB.findByESituacion", query = "SELECT e FROM EstudianteEJB e WHERE e.eSituacion = :eSituacion"),
    @NamedQuery(name = "EstudianteEJB.findByEEstado", query = "SELECT e FROM EstudianteEJB e WHERE e.eEstado = :eEstado")})
public class EstudianteEJB implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer eCodigo;
    @Size(max = 255)
    @Column(length = 255)
    private String eSemestre;
    @Size(max = 255)
    @Column(length = 255)
    private String eSituacion;
    @Size(max = 255)
    @Column(length = 255)
    private String eEstado;
    @ManyToMany(mappedBy = "estudianteEJBCollection")
    private Collection<GrupoEJB> grupoEJBCollection;
    @OneToMany(mappedBy = "estudianteECodigo")
    private Collection<MatriculafinancieraEJB> matriculafinancieraEJBCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "estudianteEJB")
    private Collection<HistorialnotaEJB> historialnotaEJBCollection;
    @JoinColumn(name = "PersonaPIdentificacion", referencedColumnName = "PIdentificacion")
    @ManyToOne
    private PersonaEJB personaPIdentificacion;

    public EstudianteEJB() {
    }

    public EstudianteEJB(Integer eCodigo) {
        this.eCodigo = eCodigo;
    }

    public Integer getECodigo() {
        return eCodigo;
    }

    public void setECodigo(Integer eCodigo) {
        this.eCodigo = eCodigo;
    }

    public String getESemestre() {
        return eSemestre;
    }

    public void setESemestre(String eSemestre) {
        this.eSemestre = eSemestre;
    }

    public String getESituacion() {
        return eSituacion;
    }

    public void setESituacion(String eSituacion) {
        this.eSituacion = eSituacion;
    }

    public String getEEstado() {
        return eEstado;
    }

    public void setEEstado(String eEstado) {
        this.eEstado = eEstado;
    }

    @XmlTransient
    public Collection<GrupoEJB> getGrupoEJBCollection() {
        return grupoEJBCollection;
    }

    public void setGrupoEJBCollection(Collection<GrupoEJB> grupoEJBCollection) {
        this.grupoEJBCollection = grupoEJBCollection;
    }

    @XmlTransient
    public Collection<MatriculafinancieraEJB> getMatriculafinancieraEJBCollection() {
        return matriculafinancieraEJBCollection;
    }

    public void setMatriculafinancieraEJBCollection(Collection<MatriculafinancieraEJB> matriculafinancieraEJBCollection) {
        this.matriculafinancieraEJBCollection = matriculafinancieraEJBCollection;
    }

    @XmlTransient
    public Collection<HistorialnotaEJB> getHistorialnotaEJBCollection() {
        return historialnotaEJBCollection;
    }

    public void setHistorialnotaEJBCollection(Collection<HistorialnotaEJB> historialnotaEJBCollection) {
        this.historialnotaEJBCollection = historialnotaEJBCollection;
    }

    public PersonaEJB getPersonaPIdentificacion() {
        return personaPIdentificacion;
    }

    public void setPersonaPIdentificacion(PersonaEJB personaPIdentificacion) {
        this.personaPIdentificacion = personaPIdentificacion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (eCodigo != null ? eCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EstudianteEJB)) {
            return false;
        }
        EstudianteEJB other = (EstudianteEJB) object;
        if ((this.eCodigo == null && other.eCodigo != null) || (this.eCodigo != null && !this.eCodigo.equals(other.eCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Modelo.EstudianteEJB[ eCodigo=" + eCodigo + " ]";
    }
    
}
